<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8" isELIgnored="false"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> 
<div class="r_location">
	<i class="r_txtico"></i> 微信配置管理 &gt; 配置微信自定义消息回复
</div>
<form id="add_func_form"  method="post"  action="cms/wechatmsg/add">
		<ul class="all_list">
                  <li>
                   <span class="all_title">消息类型:</span>  <span>
                        <select name="messageType" id="message_type" class="ui_input"  >
                            <option value="text" selected="selected">文本</option>
                            <option value="news">图文</option>
                        </select>
                            </span>
                  </li>
                  <li>
                         <span class="all_title">渠道:</span> <span>
                         <input   type="text" class="ui_input"  style="width:200px;" validator='{"label":"渠道","minLength":2,"maxLength":15}'   id="channel" name="channel"/>
                         <font style="color: red;">*这里填写的渠道要跟生成渠道二维码参数一致</font>
                            </span>
                      </li>
                  <li>
                     <div class="span12 field-box" data-id="text">
                         <span class="all_title">文本消息:</span><span>
                         <textarea class="span8" name="text" rows="3" cols="50"  id="text"></textarea> </span>
                     </div>
                     </li>
                  <li>
                     <div class="span12 field-box" data-id="news">
                         <span class="all_title">标题:<font style="color: red;">*</font></span>
                         <input class="ui_input"  style="width:300px;" type="text" id="Title" name="Title"/>
                     </div>
                     </li>
                  <li>
                     <div class="span12 field-box" data-id="news">
                         <span class="all_title">描述:<font style="color: red;">*</font></span>
                         <input class="ui_input" style="width:500px;" type="text" id="Description" name="Description"/>
                     </div>
                     </li>
                  <li>
                     <div class="span12 field-box" data-id="news">
                         <span class="all_title">图片地址:<font style="color: red;">*</font></span>
                         <input class="ui_input"   style="width:500px;" type="text" id="PicUrl" name="PicUrl"/>
                     </div>
                     </li>
                  <li>
                     <div class="span12 field-box" data-id="news">
                         <span class="all_title">图文地址:<font style="color: red;">*</font></span>
                         <input class="ui_input" style="width:500px;"  type="text" id="Url" name="Url"/>
                     </div>
                     </li>
                  <li>
                     <div class="span12 field-box" >
                         <span style="color: red;" id="error_message"></span>
                     </div>
                   </li>
                   <li>
					<span class="all_title"></span>
					<span> 
						<input type="button" id="save_button" value="保存" class="submit_btn m-r15 submitBtn">
					</span>
					</li>
		</ul>
	</form>
<script type="text/javascript">
	$(function(){
		      
		function showDialog(url, options) {
			myDialog = art.dialog(options);// 初始化一个带有loading图标的空对话框
			$.post(url, options.param, function(data) {
				myDialog.content(data);
			});
		}
		
		$("#message_type").change(function(){
			var message_type = $("#message_type").val();
			if(message_type == "text"){
				$(document).find("div[data-id='news']").css("display","none");
				$(document).find("div[data-id='text']").css("display","");
			}else{
				$(document).find("div[data-id='text']").css("display","none");
				$(document).find("div[data-id='news']").css("display","");
			}
		});
		$("#message_type").change();
		
		$("#add_func_form").validator({},{
			callback:function(result){
				$("#add_func_form").ajaxSubmit(function(data){
					if (data.success == 'succeed') {
						art.dialog({icon: 'succeed',content: data.message,lock:true}).time(1);
						to_page("/cms/wechatmsg/view/page");
					} else {
						art.dialog({icon: 'error',content: data.message,lock:true}).time(1);
					}
				});
			}
		});
	});
</script>